﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using MySoft.Data;
using SDLITS.Common;
using SDLITS.Model;
using FineUI;

namespace SDLITS.Web.Personal
{
    public partial class ChangePwd : CommonBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ModelLoginUser modelLoginUser = Session["LoginUser"] as ModelLoginUser;
                if (modelLoginUser != null)
                {
                    lblname.Text = modelLoginUser.UserName;
                }
            }
        }
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            if (txt_NewPwd.Text != txt_NewPwd2.Text)
            {
                Alert.Show("两次密码输入不一致！");
                return;
            }
            ModelLoginUser modelLoginUser = Session["LoginUser"] as ModelLoginUser;
            User tea = new User();
            tea.UserID = modelLoginUser.UserID;
            tea.Attach();
            tea.UserPwd = txt_NewPwd.Text.Trim();
            int returnValue = SDDbSession.Default.Update<User>(tea);
            {
                Alert.ShowInTop("修改密码成功！");
                PageContext.RegisterStartupScript(ActiveWindow.GetHideReference());
            }
        }

    }
}